Skipping problem 1, no review needed…
The time-series plot shows that the DGP reverts to its mean, but also has shocks that linger for a perior or two. According to the decomposition model there’s no clear seasonal pattern or trend. Looking at the ACF there’s no geometric decline as would be expected in the presence of autocorrelation. An MA(2) with a small positive first-order coefficient but relatively large negative second-order coefficient captures the observed characteristic where shocks that last a period extra but do not have a lingering effect like with autoregression. The ACF and PACF of the time-series show a small positive spike for L1, but a substantial negative spike for L2 (\(\approx 0.5\)). I used arima.sim to simulate a MA(1), \(\psi_1 = 0.1, \psi_2 = -0.5\) process and the result is similar in its temporal structure though the precise shocks and levels over time differ.
#pull time-series a
let <- "a"
ts_test <- ts(prob2[[let]], frequency = 12)
#time-series plot
autoplot(ts_test) +
labs(title = "Observed time-series a") +
theme_minimal()
#decomposition model
#autoplot(decompose(ts_test, type = "additive")) +
# theme_minimal()
#ACF
#ggAcf(ts_test) +
# theme_minimal() +
# labs(title = "")
#PACF
#ggPacf(ts_test) +
# theme_minimal() +
# labs(title = "")
#plot simulated ts: MA(1), psi = .75, T=100
autoplot(arima.sim(list(order = c(0, 0, 2), ma = c(0.1, -.5)), n = 100)) +
labs(title = TeX("Simulated MA(2), $\\psi_1 = 0.1, \\psi_2 = -0.5$")) +
theme_minimal()
There appears to be a seasonal pattern looking at the time-series plot. Decomposing the time-series into its seasonal component shows that the end of each year spikes to high levels, and then reverts back to a very small/negligble seasonal effect. Plotting the ACF before removing the additive seasonal means shows a spike in autocorrelation at lag 12, corresponding to the same month of the last year. After removing the seasonal average from each observation, the ACF shows no substantial autocorrelation.
#pull time-series b
let <- "b"
ts_test <- ts(prob2[[let]], frequency = 12)
#plot time-series
#autoplot(ts_test) +
# theme_minimal()
#plot decomposition model
#autoplot(decompose(ts_test, type = "additive")) +
# theme_minimal()
#plot unadjusted ACF
#ggAcf(ts_test) +
# theme_minimal() +
# labs(title = "")
#store decomposition model
decomp <- decompose(ts_test, type = "additive")
#seasonally adjust (y - seasonal mean for y)
ts_test <- ts_test - decomp$seasonal
#plot adjusted time-series
autoplot(ts_test) +
labs(title = "Seasonally-adjusted time-series b") +
theme_minimal()
#plot adjusted ACF
#ggAcf(ts_test) +
# theme_minimal() +
# labs(title = "")
There appears to be a deterministic trend according to the time-series plot and decomposition model. The ACF has some semblance to an AR process, albeit without a clearly geometric decline in autocorrelation as might be expected. Detrending the data using a linear model shows that the removing deterministic trend explains away the early trappings of autoregression (i.e. the detrended time-series looks like white noise, ACF has no structure).
#pull time-series c
let <- "c"
ts_test <- ts(prob2[[let]], frequency = 12)
#plot time-series
autoplot(ts_test) +
labs(title = "Observed time-series c") +
theme_minimal()
#plot decomposition model
#autoplot(decompose(ts_test, type = "additive")) +
# theme_minimal()
#plot observed ACF
#ggAcf(ts_test) +
# theme_minimal() +
# labs(title = "")
#looks like trend, let's estimate the monthly trend
time <- 1:100
lm_c <- lm(ts_test ~ time)
#summary(lm_c) #about .03 increase per month
#subtract estimated trend from time-series
ts_test <- ts_test - lm_c$coefficients[2]*time
#plot de-trended series
autoplot(ts_test) +
labs(title = "De-trended time-series c") +
theme_minimal()
#plot de-trended ACF
#ggAcf(ts_test) +
# labs(title = "De-trended ACF for time-series c") +
# theme_minimal() +
# labs(title = "")
There seems to be an autoregressive or moving-average process using the time-series plot as a first-look, but there is no trend. The decomposition model also suggests no trend, and though the seasonal pattern is plausible (i.e. summer months dip, rises through fall) in the absence of any notion of what the underlying time-series it does not seem to explain much overall variation in the series. While plotting the ACF of the time-series shows a spike at L1, the effect of the prior period dies off quickly (evidence in favor of MA). The PACF shows the L1 spike is about 0.5, though there are also spikes at L2 and L3 (with negative and positive signs, respectively). Based off of the inconsistent evidence of autocorrelation and quick mean reversion, a moving average process seems most likely. I simulated an MA(1) with \(\psi = 0.5\), MA(2) with \(\psi_1 = 0.5, \psi_2 = -0.25\) to investigate the DGP further. Both have a positive first-order term because a shock in the prior period lingers for another period, but the MA(2) has a second-order negative term driving the time-series back to the mean faster. Based off of my inspection of these simulations I think the MA(2) is most appropriate.
#pull time-series d
let <- "d"
ts_test <- ts(prob2[[let]], frequency = 12)
#plot time-series
autoplot(ts_test) +
theme_minimal() +
labs(title = "Observed time-series d")
#plot decomposition model
#autoplot(decompose(ts_test, type = "additive")) +
# theme_minimal()
#plot ACF
#ggAcf(ts_test) +
# theme_minimal() +
# labs(title = "")
#plot PACF
#ggPacf(ts_test) +
# theme_minimal() +
# labs(title = "")
#plot simulated ts: MA(1), psi = .5, T=100
#autoplot(arima.sim(list(order = c(0, 0, 1), ma = c(0.5)), n = 100))
#plot simulated ts: MA(2), phi = .5, T=100
autoplot(arima.sim(list(order = c(0, 0, 2), ma = c(0.5, -0.25)), n = 100)) +
theme_minimal() +
labs(title = TeX("Simulated MA(2), $\\phi_1 = 0.5, \\phi_2 = -0.25$"))
The time-series plot gives pretty clear indication of autocorrelation, since high values beget high values, while low values similarly follow preceding low values. The decomposition model indicates an unlikely U-shaped seasonal variation that otherwise does not fit the time-series, also shows no evidence of trend. PLotting the ACF, however, shows a geometric decline in autocorrelation that extends out to about L3 at substantial levels. The PACF suggests that one lag is sufficient for the series’ autocorrelation, and that the AR(1) has a plausible coefficient of \(\phi = 0.7\)
#pull time-series e
let <- "e"
ts_test <- ts(prob2[[let]], frequency = 12)
#plot time-series e
#autoplot(ts_test) +
# theme_minimal()
#autoplot(decompose(ts_test, type = "additive")) +
# theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
#ggPacf(ts_test) +
# theme_minimal() +
# labs(title = "")
Seasonal
#pull time-series f
let <- "f"
ts_test <- ts(prob2[[let]], frequency = 12)
#plot time-series
#autoplot(ts_test) +
# theme_minimal()
#plot decomposition model
#autoplot(decompose(ts_test, type = "additive")) +
# theme_minimal()
#plot ACF
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
#plot PACF
#ggPacf(ts_test) +
# theme_minimal() +
# labs(title = "")
#store decomposition model
decomp <- decompose(ts_test, type = "additive")
#seasonally adjust (y - seasonal mean for y)
ts_test <- ts_test - decomp$seasonal
#plot time-series
autoplot(ts_test) +
labs(title = "Seasonally-adjusted time-series f") +
theme_minimal()
let <- "g"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
MA(1)
#pull time-series h
let <- "h"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
#ggPacf(ts_test) +
# theme_minimal() +
# labs(title = "")
let <- "i"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "j"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "k"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "l"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
** Multiple time-series characteristics ahead! **
let <- "m"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "n"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "o"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "p"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "q"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")
let <- "r"
ts_test <- ts(prob2[[let]], frequency = 12)
autoplot(ts_test) +
theme_minimal()
autoplot(decompose(ts_test, type = "additive")) +
theme_minimal()
ggAcf(ts_test) +
theme_minimal() +
labs(title = "")
ggPacf(ts_test) +
theme_minimal() +
labs(title = "")